cmake_minimum_required(VERSION 3.5)

project(rubbish-clear)

set(TOP_DIR ${CMAKE_CURRENT_LIST_DIR}/../../)
set(RUBBISH_CLEAR_DIR ${CMAKE_CURRENT_LIST_DIR})
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

add_library(${PROJECT_NAME} SHARED)

execute_process(COMMAND bash ${RUBBISH_CLEAR_DIR}/translations/generate_translations_ts.sh
                WORKING_DIRECTORY ${RUBBISH_CLEAR_DIR})
execute_process(COMMAND bash ${RUBBISH_CLEAR_DIR}/translations/generate_translations_qm.sh
                WORKING_DIRECTORY ${RUBBISH_CLEAR_DIR})

target_compile_options(${PROJECT_NAME} PRIVATE -Wall -g -rdynamic)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)

target_include_directories(${PROJECT_NAME} PRIVATE ${TOP_DIR}/interface)
target_include_directories(${PROJECT_NAME} PRIVATE ${TOP_DIR}/3rdparty/kyplugin)

find_package(Qt5 COMPONENTS Widgets DBus REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Widgets PRIVATE Qt5::DBus)

find_package(Qt5 COMPONENTS Svg REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Svg )
#UISDK添加
find_package(PkgConfig REQUIRED)
pkg_check_modules(KYSDKQTWIDGETS_PKG kysdk-qtwidgets)
target_include_directories(${PROJECT_NAME} PRIVATE ${KYSDKQTWIDGETS_PKG_INCLUDE_DIRS})
target_link_directories(${PROJECT_NAME} PRIVATE ${KYSDKQTWIDGETS_PKG_LIBRARY_DIRS})
target_link_libraries(${PROJECT_NAME} PRIVATE ${KYSDKQTWIDGETS_PKG_LIBRARIES})
#UISDK添加
#SDKt添加
find_package(PkgConfig REQUIRED)
pkg_check_modules(KYSDKKABASE_PKG kysdk-kabase)
target_include_directories(${PROJECT_NAME} PRIVATE ${KYSDKKABASE_PKG_INCLUDE_DIRS})
target_link_directories(${PROJECT_NAME} PRIVATE ${KYSDKKABASE_PKG_LIBRARY_DIRS})
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Widgets ${KYSDKKABASE_PKG_LIBRARIES})
#SDKt添加

file(GLOB SRCS
    "clearmainwidget.cpp"
    "rubbishclearentr.cpp"
    "connecter.cpp"
    "clearwidgetkinditem.cpp"
    "selectcategorywidget.cpp"
    "selectlistitem.cpp"
    "selectlistwidget.cpp"
    "systembutton.cpp"
    "cleanerwidget.cpp"
    "cleandetailveiw.cpp"
    "selectwidget.cpp"
    "cleartrash.cpp"
    "publicstatus.cpp"
    "clearmanager.cpp"
    "kalertdialog.cpp"
    "toolutils.cpp"
    "custom_label.cpp"
    "common_ui.cpp"

    "clearmainwidget.h"
    "rubbishclearentr.h"
    "clearwidgetkinditem.h"
    "clearcommon.h"
    "selectcategorywidget.h"
    "selectlistitem.h"
    "selectlistwidget.h"
    "systembutton.h"
    "utils.h"
    "cleanerwidget.h"
    "cleandetailveiw.h"
    "selectwidget.h"
    "clownTips.h"
    "cleartrash.h"
    "publicstatus.h"
    "clearmanager.h"
    "kalertdialog.h"
    "toolutils.h"
    "custom_label.h"
    "common_ui.h"

    "dbus/*.cpp"
    "dbus/*.h"
    "res.qrc"
    "${TOP_DIR}/interface/kymanager_plugin.cpp")
file(GLOB TRANS
    "${RUBBISH_CLEAR_DIR}/translations/kylin-os-manager-rubbish-clear_zh_CN.qm"
    "${RUBBISH_CLEAR_DIR}/translations/kylin-os-manager-rubbish-clear_bo_CN.qm"
    "${RUBBISH_CLEAR_DIR}/translations/kylin-os-manager-rubbish-clear_ug.qm"
    "${RUBBISH_CLEAR_DIR}/translations/kylin-os-manager-rubbish-clear_kk.qm"
    "${RUBBISH_CLEAR_DIR}/translations/kylin-os-manager-rubbish-clear_ky.qm")

target_sources(${PROJECT_NAME} PRIVATE ${SRCS})

install(TARGETS ${PROJECT_NAME} DESTINATION /opt/kylin-os-manager/plugins/)
install(FILES ${TRANS} DESTINATION  /usr/share/kylin-os-manager/translations/)
